package com.alphathink.deliveryassist.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;

/**
 * 缓存 用于存取用户的一些状态以及基本的记录
 * 
 * @ClassName: SharePrefUtil
 * @Description: TODO
 * @author alphathink xpg
 * @date 2015-2-27 下午4:53:48
 * 
 */
public class SharePrefUtil {

	private static SharedPreferences preferences = null;

	public static String APP_NAME = "DeliveryAssit";
	/** 记录用户是否登录 */
	public static String STATE = "STATE";

	/** 记录用户经常选择的 模式 0:电话模式,1:短信模式 */
	public static String SELECTMODEL = "SELECTMODEL";

	/** 升级apk存放的目录 **/
	public static String APK_DIR = Environment.getExternalStorageDirectory()
			.getAbsolutePath() + "/DeliveryAssist/apk/";
	/** 版本检测的ｕｒｌ */
	public static String CHECK_VERSION_URL = "http://115.159.92.92/projectUpdates/kuaidi/version.cfg";
	/** 版本更新的url */
	public static String UPDATE_VERSION_URL = "http://115.159.92.92/projec         tUpdates/kuaidi/Test.apk";
	/** 本地版本 **/
	public static String LOCAL_VERSION = "LOCAL_VERSION";
	/** 登陆的账户 */
	public static String USERNAME = "USERNAME";
	/** 密码 */
	public static String LOGIN_PWD = "LOGIN_PWD";

	/** 登陆ｕｒｌ */
	public static final String LOGIN_URL = "http://115.159.92.92:8080/kuaidi/login";
	// /** 登陆ｕｒｌ */
	// public static final String LOGIN_URL =
	// "http://115.159.92.92/WebRoot/login";
	/** 更改密码的url */
	public static final String UPDATEPWD_URL = "http://115.159.92.92:8080/kuaidi/updateUser";

	public static SharedPreferences getPref(Context context) {
		if (preferences == null) {
			return context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE);
		}
		return preferences;
	}
}
